<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<body>
		<ui:composition template="../templates/template.xhtml">
       		<ui:define name="titre">Paramétrage::Gestion des modules</ui:define>
    		<ui:define name="contenu">
    		 <div id="identificationEleve">
    			 <h:form>
    			 	<rich:panel header="La liste des modules" rendered="#{fn:length(ParametrageControleur.modele.modules) > 0}">
    			 		<rich:dataTable id="modules" value="#{ParametrageControleur.modele.modules}"	
		       					 var="module" rendered="#{fn:length(ParametrageControleur.modele.modules) > 0}" rows="10">
				        	<rich:column >
				        		<f:facet name="header">
				        			<h:outputText 	value="ID" />
				        		</f:facet>
				        		<h:outputText value="#{module.id}" />
				        	</rich:column>
				        	<rich:column >
				        		<f:facet name="header">
				        			<h:outputText 	value="Libellé" />
				        		</f:facet>
				        		<h:outputText value="#{module.libelle}" />
				        	</rich:column>
				        	<rich:column >
				        		<f:facet name="header">
				        			<h:outputText 	value="Classe" />
				        		</f:facet>
				        		<h:outputText value="#{module.classe.libelle}" />
				        	</rich:column>
				        	
				        	<rich:column >
				        		<f:facet name="header">
				        			<h:outputText 	value="Enseignant" />
				        		</f:facet>
				        		<h:outputText value="#{module.enseignant.prenom} #{module.enseignant.nom}" />
				        	</rich:column>
				        	
				        	<rich:column >
				        		<h:commandLink value=" Modifier"  action="#{ParametrageControleur.modifierModule}">
				        		</h:commandLink>
				        		<h:commandLink value=" Supprimer"  action="#{ParametrageControleur.supprimerModule}">
				        		</h:commandLink>
				        	</rich:column>
		        		</rich:dataTable>
		      			 <rich:dataScroller id="pagination" for="classes" maxPages="5" rendered="#{fn:length(ParametrageControleur.modele.modules) > 10}"/>
    			 	</rich:panel>
    			 	<rich:panel header="La zone d'édition des modules">
    			 		<h:panelGrid columns="4">
			    			 <h:panelGroup>
								<h:outputLabel value="Libellé du module" for="libelleTxt" id="libelleLbl" styleClass="label" />
								<h:inputText value="#{ParametrageControleur.modele.module.libelle}" id="libelleTxt" styleClass="inputTxt"/>
							 </h:panelGroup>
						</h:panelGrid>
						<h:panelGrid columns="4">
							 <h:panelGroup>
								<h:outputLabel value="Classe" for="classeListe" id="classeLbl" styleClass="label" />
								<h:selectOneMenu id="classeListe"  value="#{ParametrageControleur.modele.classe.id}">
						        	<f:selectItem  itemLabel="--Selectionner--" itemValue="" />
						        	<f:selectItems  value="#{ParametrageControleur.modele.classesItems}"/>
			    				</h:selectOneMenu>
							</h:panelGroup>
						</h:panelGrid>
						<h:panelGrid columns="4">
							<h:panelGroup>
								<h:outputLabel value="Enseignant" for="enseignatListe" id="enseignantLbl" styleClass="label" />
								<h:selectOneMenu id="moduleListe"  value="#{ParametrageControleur.modele.enseignant.id}">
						        	<f:selectItem  itemLabel="--Selectionner--" itemValue="" />
						        	<f:selectItems  value="#{ParametrageControleur.modele.enseignantItems}"/>
			    				</h:selectOneMenu>
			        		</h:panelGroup>
		        		</h:panelGrid>
    			 	</rich:panel>
    			 	<h:panelGrid id="actions" columns="5">
				     	<h:commandButton value="Nouveau" style="width:85px" action="#{ParametrageControleur.ajouterEnseignant}" reRender="classes,pagination"/>
				     	<h:commandButton  value="Modifier" style="width:85px" action="#{ParametrageControleur.modifierEnseignant}"/>
		     	
		    		 </h:panelGrid>
    			 </h:form>
    			 </div>
			</ui:define>
		</ui:composition>
	</body>
</html>